<!--  -->
<template>
  <div class="urlTable">
    <el-table :data="tableData" style="width: 100%" border>
      <el-table-column label="推送url" prop="url">
      </el-table-column>
    </el-table>
    <div class="pagebox">
      <el-pagination
        @current-change="handleCurrentChange"
        :page-size="pageSize"
        layout="prev, pager, next"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    dataTable: {
      type: Array
    }
  },
  created () {
    this.tableDataAll = []
    this.dataTable.forEach(item => {
      let obj = {}
      obj.url = item
      this.tableDataAll.push(obj)
    })
    this.total = this.dataTable.length
    this.current = 1
    this.gettableData(this.current)
  },
  data () {
    return {
      tableDataAll: [],
      tableData: [],
      total: 0,
      pageSize: 10,
      current: 1
    }
  },
  watch: {
  },
  computed: {
  },
  methods: {
    gettableData (pageCur) {
      this.tableData = []
      for (let i = (pageCur - 1) * this.pageSize; i < pageCur * this.pageSize && i < this.tableDataAll.length; i++) {
        this.tableData.push(this.tableDataAll[i])
      }
    },
    handleCurrentChange (val) {
      this.current = val
      this.gettableData(this.current)
    }
  }
}
</script>

<style scoped lang="scss">
.urlTable /deep/ .el-table .el-table__cell{
  padding:6px 0;
}
.pagebox{
  margin-top: 10px;
  text-align: right;
}
</style>
